<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Returns a bit mask of recommended backends for current
  platform.</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ev.nowupdate.html">Ev::nowUpdate</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ev.resume.html">Ev::resume</a></div>
 <div class="up"><a href="class.ev.html">Ev</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="ev.recommendedbackends" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">Ev::recommendedBackends</h1>
  <p class="verinfo">(PECL ev &gt;= 0.2.0)</p><p class="refpurpose"><span class="refname">Ev::recommendedBackends</span> &mdash; <span class="dc-title">Returns a bit mask of recommended backends for current
  platform.</span></p>

 </div>
 <div class="refsect1 description" id="refsect1-ev.recommendedbackends-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="modifier">final</span>
   <span class="modifier">public</span>
   <span class="modifier">static</span>
   <span class="type"><span class="type void">void</span></span> 
   <span class="methodname"><strong>Ev::recommendedBackends</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">
   Returns the set of all backends compiled into this binary of
   <em>libev</em>
   and also recommended for this platform, meaning it will work for most file
   descriptor types. This set is often smaller than the one returned by
   <span class="function"><strong>ev_supported_backends()</strong></span>
   , as for example
   <em>kqueue</em>
   is broken on most
   <em>BSD</em>
   systems and will not be auto-detected unless it is requested explicitly.
   This is the set of backends that
   <em>libev</em>
   will probe no backends specified explicitly.
  </p>
 </div>

 <div class="refsect1 parameters" id="refsect1-ev.recommendedbackends-parameters">
  <h3 class="title">参数</h3>
  <p class="para">此函数没有参数。</p>
 </div>

 <div class="refsect1 returnvalues" id="refsect1-ev.recommendedbackends-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   Returns a bit mask which can containing
   <a href="class.ev.html#ev.constants.watcher-backends" class="link">backend flags</a>
   combined using bitwise
   <em class="emphasis">OR</em>
   operator.
  </p>
 </div>

 <div class="refsect1 examples" id="refsect1-ev.recommendedbackends-examples">
  <h3 class="title">范例</h3>
 <div class="example" id="example-3531">
   <p><strong>Example #1 Embedding one loop into another</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">/*<br />*&nbsp;Try&nbsp;to&nbsp;get&nbsp;an&nbsp;embeddable&nbsp;event&nbsp;loop&nbsp;and&nbsp;embed&nbsp;it&nbsp;into&nbsp;the&nbsp;default&nbsp;event&nbsp;loop.<br />*&nbsp;If&nbsp;it&nbsp;is&nbsp;impossible,&nbsp;use&nbsp;the&nbsp;default<br />*&nbsp;loop.&nbsp;The&nbsp;default&nbsp;loop&nbsp;is&nbsp;stored&nbsp;in&nbsp;$loop_hi,&nbsp;while&nbsp;the&nbsp;embeddable&nbsp;loop&nbsp;is<br />*&nbsp;stored&nbsp;in&nbsp;$loop_lo(which&nbsp;is&nbsp;$loop_hi&nbsp;in&nbsp;the&nbsp;case&nbsp;no&nbsp;embeddable&nbsp;loop&nbsp;can&nbsp;be<br />*&nbsp;used).<br />*<br />*&nbsp;Sample&nbsp;translated&nbsp;to&nbsp;PHP<br />*&nbsp;http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#Examples_CONTENT-9<br />*/<br /></span><span style="color: #0000BB">$loop_hi&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">EvLoop</span><span style="color: #007700">::</span><span style="color: #0000BB">defaultLoop</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">$loop_lo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /></span><span style="color: #0000BB">$embed&nbsp;&nbsp;&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">NULL</span><span style="color: #007700">;<br /><br /></span><span style="color: #FF8000">/*<br />*&nbsp;See&nbsp;if&nbsp;there&nbsp;is&nbsp;a&nbsp;chance&nbsp;of&nbsp;getting&nbsp;one&nbsp;that&nbsp;works<br />*&nbsp;(flags'&nbsp;value&nbsp;of&nbsp;0&nbsp;means&nbsp;autodetection)<br />*/<br /></span><span style="color: #0000BB">$loop_lo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">embeddableBackends</span><span style="color: #007700">()&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">recommendedBackends</span><span style="color: #007700">()<br />&nbsp;?&nbsp;new&nbsp;</span><span style="color: #0000BB">EvLoop</span><span style="color: #007700">(</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">embeddableBackends</span><span style="color: #007700">()&nbsp;&amp;&nbsp;</span><span style="color: #0000BB">Ev</span><span style="color: #007700">::</span><span style="color: #0000BB">recommendedBackends</span><span style="color: #007700">())<br />&nbsp;:&nbsp;</span><span style="color: #0000BB">0</span><span style="color: #007700">;<br /><br />if&nbsp;(</span><span style="color: #0000BB">$loop_lo</span><span style="color: #007700">)&nbsp;{<br />&nbsp;</span><span style="color: #0000BB">$embed&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">EvEmbed</span><span style="color: #007700">(</span><span style="color: #0000BB">$loop_lo</span><span style="color: #007700">,&nbsp;function&nbsp;()&nbsp;{});<br />}&nbsp;else&nbsp;{<br />&nbsp;</span><span style="color: #0000BB">$loop_lo&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$loop_hi</span><span style="color: #007700">;<br />}<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>

 <div class="refsect1 seealso" id="refsect1-ev.recommendedbackends-seealso">
  <h3 class="title">参见</h3>
  <ul class="simplelist">
   <li class="member">
    <a href="class.evembed.html" class="classname">EvEmbed</a>
   </li>
   <li class="member">
    <span class="methodname"><a href="ev.embeddablebackends.html" class="methodname" rel="rdfs-seeAlso">Ev::embeddableBackends()</a> - Returns the set of backends that are embeddable in other event loops.</span>
   </li>
   <li class="member">
    <span class="methodname"><a href="ev.supportedbackends.html" class="methodname" rel="rdfs-seeAlso">Ev::supportedBackends()</a> - Returns the set of backends supported by current libev
  configuration.</span>
   </li>
   <li class="member">
    <a href="class.ev.html#ev.constants.watcher-backends" class="link">Backend flags</a>
   </li>
   <li class="member">
    <a href="ev.examples.html" class="link">Examples</a>
   </li>
  </ul>
 </div>

</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="ev.nowupdate.html">Ev::nowUpdate</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="ev.resume.html">Ev::resume</a></div>
 <div class="up"><a href="class.ev.html">Ev</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>
